Part Number Hot Search : 
8069X XXMCX AD8328 SY100 SP13TR AD8200 DS21602N B10NB5
Product Description
Full Text Search
 

To Download AN1320 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  1/20 AN1320 application note december 2000 1.0 introduction roughly speaking a hf-tl ballast converts the 50-60hz input to a high frequency output, usually in the range of 25-125khz. a rectifier block and a dc to high frequency inverter usually make up a ballast. the half bridge of the inverter can be driven in different ways with different ics. we will focus on a specific driver: the l6574. we will see first how the l6574 can drive and control a ballast, then how it can communicate and be supervised by a m c. the aim of this paper is to examine if there are advantages in having a m c work with l6574, the feasibility of this cooperation, and a practical example. 2.0 l6574 l6574 is a bcd off line 16 pin ic specifically designed for ballast applications [ref.1](see fig.1). it has both driver functions and controller functions on board. the most useful characteristics to control the lamp are: n preheat and frequency shifting timing n cmos shut down input n sense op-amp for closed loop control or protection failures the parameters of the application are set by external components (resistors and capacitors) connected to the ic. l6574 allows the user to set all the parameters according to the lamp characteristics, and the ballast will be a high performance one. there is a specific application note on this ic (ref. [2]): here you find the description of 58w tl ballast with pfc section. please refer to this application note and to the l6574 datasheet for the ic details. in the following paragraphs we will focus our attention on a way to interface the l6574 with the micro- controller rather than on l6574 - stand alone performances. the aim of this supervision is to control the three points mentioned above. by francesca sandrini and luca rodeschini l6574 & microcontroller in ballast applications there is an increasing demand for flexibility in ballast applications. this means a request for having ballast that can be used for different tubes without changing the soldered components. the aim is to save money by using less parts (resistors, capacitors and so on) and less ballast models to be stored and managed. a way that is going to be investigated is the use of microcontroller which can supervise the application in such a way that the key parameters of the application can be modified according to the tube charac- teristics just by changing the micro-code. in this application note we will exploit a way to interface a microcontroller with our integrated ballast controller: the l6574.
AN1320 application note 2/20 figure 1. l6574 block diagram 3.0 l6574: how to set frequencies, timing, fault signals in an analog application in this paragraph we will have a snap shot of the l6574 working, just as far as the characteristics important for the micro interface are concerned. for further details please refer to [1] and [2]. the l6574 typical behavior is shown in fig. 2: there is a starting frequency (f max or f pre ) that is constant for a set preheat time t pre , than there is a frequency shift towards f min that last 0.1 of t pre and is called t ign or t sh . figure 2. frequency shift leads 1, 2, 3, 4 are used to set frequencies and timing. the capacitor connected to pin 1[cpre] sets the preheat time: t pre = k1 c pre the ignition time, or better, the time to let frequency shift from preheat value to the min. value is one tenth of t pre . the current that charges and discharges the capacitor connected to pin 3 (c f ) sets the half bridge oscillating frequency. the current that charges c f is set by the current that flows out from pin 2 and 4 during preheat and from pin 4 gnd v ref imin r ign vco en1 v the v the en2 v s v boot out c boot load h.v. lvg uv detection v s hvg 5 6 7 4 2 3 1 12 9 8 10 11 14 15 16 bootstrap driver hvg driver lvg driver vthpre ifs c pre v ref imax r pre cf op amp + - opout opin- opin+ dead time driving logic control logic + - ipre + - + - + - level shifter d97in493b fmax fmin freq time tpre tsh normal operation preheating phase ignition phase
AN1320 application note 3/20 alone during the on phase. as pin 2 and 4 are at 2v, the currents that flow out of them is inversely proportional to the resistance connected between gnd and pin 2 (r pre ) and between gnd and pin 4 (r ign ). there are some useful formula: choosing properly the resistor and the capacitor values the designer can set the desired frequencies and timing. when the designer has to do another application for another lamp type, he has to change the resistors and ca- pacitors in order to have another range of frequencies. for protection in case of lamp failure two logic input are provided: pin8 [en1] and pin9 [en2]. both are active high, but they have different functions: when en2 is activated it forces the ic to start again the preheat se- quence. when en1 is activated it shut down the ic until v cc is removed or until en2 is pulled high. en2 is usually used as ignition fault: if the lamp is not ignited, the preheat sequence starts again. en1 can be used to sense lamp removal / replacement or disconnection. figure 3. en1 ? max 1.41 r pre r ign + () r pre r ign c? --------------------------------------------------- = ? min 1.41 r ign c? ----------------------- - = v cc lvg hvg en1 v suvp d97in490
AN1320 application note 4/20 figure 4. en2 l6574 has also a sense op-amp that can be used to have a closed loop control of the lamp. we can give a volt- age reference to the non-inverting input, a signal proportional to the load current to the inverting input, and we can connect the op amp output pin to pin #4. in this way if the current in the load exceeds the reference the op amp will sink from pin 4 an additional amount of current that has to be added to the current that flows through r ign . so the current charging c f will increase, that means a higher half bridge oscillation frequency, that means a lower current in the load. changing the reference voltage on the non-inverting input of the op amp we change the frequency of the oscillator, that means we change the current in the load, and this allows lamp dimming. figure 5. closed loop v cc t pre t pre t sh t sh f pre f ing en2 f out v suvp d97in491b q3 stp4nb50/ stp6nb50 r25 0.68 c9 8.2nf r18 100k r19 100k d3 1n4148 r33 9.1k 65 4 7+ rign - d98in818a
5/20 AN1320 application note figure 6. an993 demo application circuit q2 stp4nb50/ stp6nb50 c12 100nf c14 1 m f c13 470pf r25 0.68 bridge fuse ntc l1 2.1mh c7 22 m f 450v dz1 14v c6 4.7 m f 25v c8 100nf d1 byt11600 c17 100nf 250v c19 8.2nf 1500v lamp d3 1n4148 r15 1.5k r14 4.7k r18 100k r19 100k r21 22 r22 22 q3 stp4nb50/ stp6nb50 2 7 6 5 1 9 8 11 14 15 16 12 3 4 10 l6574 r13 100k r33 9.1k r17 9.1k c9 8.2nf 1 2 6 5 4 7 8 l6561 r1 1.5m r5 68k r3 120k r6 22 r9 0.68 r12 9.53k r11 750k r16 47 d4 q1 stp6nb50 c2 220nf 400v c3 10nf c4 680nf c11 680pf 630v r23 47k r20 47k r7 47k r4 120k r27 6.8k r30 3.9k c16 1 m f r32 20k c15 330nf r29 750k r28 750k r26 390k r24 6.8k c5 100nf r10 750k c1 220nf 630v c18 100nf 250v d2 1n4148 r sense r8 0.68 t1 1.24mh (e25*13*7) 10 turns 1.3mm gapped c20 100nf r2 10.1k 3 1n4148 d99in1064
AN1320 application note 6/20 4.0 l6574: how to set frequencies, timing, fault signals in a microcontrolled application we have seen that the frequencies in l6574 are set by fixing the current that flows out from pin 2 and 4 and fixing the value of the c f capacitor. a microcontroller output pin can give us a high logic level (5v) a low logic one (0v) or a pwm output at fixed frequency and variable duty cycle. we can not use the pwm to act directly on c f pin, because the rising edge on c f is the low side mosfet on time and the falling edge is the high side mosfet one. the half bridge would oscillate in asymmetrical way at fixed frequency instead of at 50% duty cycle and variable frequency. so we have to interface the m c with the pins that set the current that charges c f . a push pull output that gives us just 0v or 5v can not be used to in- terface pin 2 and 4 because they have a maximum voltage level up to 2v. we have to use the integrated value of a pwm signal to set a voltage level between 0v and 2v. we can use a pwm output also to give the op amp the voltage reference to change the load current (and so the lamp power to perform dimming) acting on l6574 pin 4 and (or) on pin 7 (opamp+) we can control the inverter working frequency. if we want to control the preheat timing and frequency we have to act on pins 2 and 1. first we have to avoid that the l6574 fixes the preheat time by itself. if we connect to pin 1 a very small cap (e.g. 1nf), the l6574 an- alog t pre will be so small to be invisible to the lamp (i.e. less than 2ms). during these 2 ms, the oscillating frequency has to be high enough to avoid lamp filaments preheat (> 150khz). the resistor connected to pin 2 has to be sized properly. after these 2 ms l6574 is in working mode: it means that pin 4 is no more involved in fixing the frequency. only c f and r ign (pin 3 and 4) set it. now the effective preheat time can be decided by the m c just acting on the pwm that gives the voltage reference to pin 4. for example, it can have a certain duty cycle (appropriate for the preheat freq.) for a fixed time, than it can change the duty cycle (i.e. the voltage reference) to set the ignition profile and the final working frequency. now we are able to change all the frequencies and the timing involved in lamp turning on and dimming with two connections between l6574 and the m c. the fault management can also be done by the m c: all the fault signals will be brought to it, and then it will react according to the code. a connection that can be useful is the one to pin 8 (shut down pin) that can be direct because the ics levels are compatible. in this way the m c can react to a signal either by stopping the inverter or by changing the frequency (i.e. repeating a preheat sequence if there is the no-ignition alarm, or bringing the frequency to a very high value). just with these 3 connection between the l6574 and the m c we can set nearly all the parameters of the appli- cation by software. the number of m c inputs we need for fault signals depends only on what we want to control. we need another input pin to give the m c the information about the dimming level: this is the interface between the ballast and the final user. we can use either switches or an ad input. the first solution is more expensive in terms of number of pin, the ad input requires some attention for the code part but allows a much larger num- ber of levels. 5.0 how to apply this interface to a ballast we started from an993 demo board to build a m c application with the same performances and some additional degrees of freedom. we will now apply all the concepts already discussed and put them into a working board.
7/20 AN1320 application note the hardware and software development can not be separated: it is a very interactive process. starting from the basic point there are different way to act on the l6574, depending on what we want to be software depen- dent and what we want to be hardware dependent in the final application. we will describe the two sections separately just for ease of understanding. 5.1 hardware choices first we have to choose the m c. we have chosen the st62e62c, a 16 pin m c belonging to the st6 family. this device is able to perform all the functions we need with pins left over. in this microcontroller we have just an auto reload timer, this means that we have just one pwm available. we can call this pwm the hardware pwm in the following pages, just to differentiate it from the second one we need and that is obtained by software from a standard output pin. we will call this second pwm the soft- ware pwm we have discussed in the previous chapters how to interface the m c and the l6574; the remaining problem is how to supply the ics. we have chosen a cheap way to supply the m c: we use a l7805, which is a linear regulator (5v output). it has been connected to the l6574 supply. this choice (mainly based on economical reasons) has many conse- quences: n as l6574 supply is given by a charge pump connected to the middle point of the half bridge, the l6574 has to work (to oscillate) to give the supply to the micro n the ics are not supplied at the same time, but as a sequence: the micro (the supervisor) has to be told when everything is ok to start the preheat sequence n if the l6574 is disabled (after a fault condition for example) the micro no longer has a voltage supply. when the circuit starts again the micro is reset and the program starts from the very beginning it can happen that the micro must always be supplied, even when l6574 is off. in this case another solution has to be used, e.g. a regulator connected to the rectified mains. the board start up sequence management takes into account the above mentioned point 1 and 2. using the start up resistors we let the l6574 start, so its oscillation allows the charge pump work. then the l6561 is sup- plied and the l7805 feeds the m c. this sequence is an inheritance of l6561+l6574 demo board. the co-ordi- nation between the l6574 and the l6561 is done by choosing the start up resistors and the charge pump components. the co-ordination between the micro and the analog part is a mix of hardware and software. by software we let the micro wait for a power ok signal from the l6574, that in the meanwhile keeps on oscillating at a very high frequency, so as to let the filament not to be preheated. the l6574 can provide this power ok signal for free. the internal sequence of the l6574 charges the preheat cap connected to pin 1 to 5v after the preheat and the ignition sweep has ended. we can deliver this 5v signal to a m c input, and hereafter the m c will start to set all the application parameters: in this way we are sure that everything is correctly supplied. moreover by choosing properly c pre value (i.e. very small ~1nf) this waiting time is around 2 ms, so it does not influence the overall timing: it is hundreds of time shorter than a typical preheat time. to be sure that the third condition does not happen and that there are no out of control situations in which we do not know which part of the code the micro is running we have added additional safety circuitry. after the alarm for open load or disconnection, the micro sets an output pin to the high logic level in order to activate an scr to disconnect the vcc from all the ics, pfc included. in this way the m c can supervise not only the l6574 but also the l6561.
AN1320 application note 8/20 5.2 software choices we have already done some software choose choosing the microcontroller. when we chose a microcontroller with only one pwm output we have already decided to devote a certain amount of microcontroller resources to build the pwm software (see appendix for software details). a logic sequence of actions could be: 1) to check that everything is ok - i.e. all the ics are supplied in the right way; 2) check the presence of the load 3) do the preheat sequence 4) check lamp ignition 5) set the current in the load according to the user input this is a basic set of functions typical of nearly any ballast application (see fig. 7) figure 7. flow chart st6 start up l6574 ok? open load? set fpre t>tpre? set ign freq. profile lamp on? set working freq. (freq.&loop ref.) dimming? fault cd.? #fail 9/20 AN1320 application note 6.0 board we have implemented the board whose schematic is shown in fig.8. figure 8. schematic [*]: 4 res istors 200k 0.6w each t1 1.24mh (e25*13*7)1.3mm gapped r37 10 k r7 22 r18 9.1 k c12 1u f u2 l6 57 4 op o ut 5 ou t 14 rpre 2 op i n- 6 cf 3 vs 12 lvg 11 rign 4 en 1 8 cpre 1 en 2 9 gn d 10 op i n+ 7 hvg 15 vboot 16 nc 13 r36 6.8 k r15 1.5 m r26 9.1 k r19 9.1 k d9 1n 41 48 r4 68 k r33 1.2 k r44 2.2 k r41 4.7 k c27 10 0n f q4 pn p cb e 3 2 1 r9 81 .5k r11 22 c20 1n f r29 20 0k s2 sw c24 10 0n f r16 10 0k r14 65 0k c8b1 10 0n f 2 50 v c18 33 0n f r10 39 0k c9 8.2 n r12 65 0k r25 51 0k r3 1.5 m u3 st 62 e6 2 c pb 0 1 vp p 2 pb 2 3 pb 3 4 pb 6 5 pb 7 6 vd d 7 vs s 8 pa 4 9 pa 5 10 os c_ i n 11 os c_ o ut 12 reset 13 nmi 14 pc 3 15 pc 2 16 r31 20 k c5 47 uf 2 5 v c21 10 0n f c8 10 0n f 2 50 v c1 22 0n f 6 30 v c13 1u f r8 22 r35 10 0 c3 10 0n f d13 1n4148 r27 10 .1k c26 20 pf d2 br id ge -+ r2 36 c2 1.34nf 600v d4 1n 41 48 q1 stp 6 nb 5 0 r[*] 50 k r48 10 0k r40 20 k c28 10 0n f r45 pot 4.7k r43 10 0k f1 2a 25 0 v q3 st p6 nb 5 0 r5 12 0k ntc1 10 t 1 2 r 10 k s7 sw s6 sw c7 22 0n f 4 00 v r24 3.9 k d5 14 v c29 10 uf c4 10 uf r22 8.2 k r21a 0.2 2 d11 5v s1 sw s3 sw q5 npn cbe 1 2 3 q2 stp 6 nb 50 r39 20 k r21 0.2 2 s4 sw c17 2u f r46 1k c23 20 pf c10 8.2 nf l1 2.1 mh d7 1n 41 48 u4 l7 80 5 vin 1 vout 2 gn d 3 r32 10 k c19 1u f c22 2u f c6 10 0n f c14 10 nf r28 1.2 k r47 1.5 k y1 8mh z c15 47 0p f c25 10 0n f r20 6.8 k d10 1n4148 r13 1.5 m r23 0.6 8 c11 47 uf u1 l6 56 1 in v 1 comp 2 mult 3 cs 4 zcd 5 gn d 6 gd 7 vc c 8 s5 sw r38 10 0k r42 4.7 k r17 1.2 k c16 10 0n f d6 1n 41 48 d3 stta106 r6 12 0k r1 50 d1 diod e pb 7 rif pin 4 pc3 (disconnected lamp) pb 2 portr igh t-r l6 57 4 pow er ok not ignited lamp pb6 l6561 dis pf c disable in l7805 portr igh t-r disable pb0 disc on nected lamp pb 3 pow e r ok disable l6574 rif op amp (pin 7) in l7 80 5 pc2 (not ignited lamp)
AN1320 application note 10/20 this is a double board: it can be used with the micro or without it according to the position of six switches (s1 to s6) that are on board. the microcontroller, the l7805 and some parts related to the micro (the oscillator, the reset switch and so on) are mounted on a small separated board that can be connected with a 9 pin connector to the main board. as a result the board looks huge, but we have two different application on it. it is a modular board: the six switches and the small insertion pcb let the user choose between a analog ballast and a mi- crocontrolled one. the larger board includes the analog ballast controller (that is the l6561-l6574 demo board) and some addi- tional parts that allows the use of the pcb with the microcontroller and the l7805 regulator. you can choose the control system setting by the proper position of 6 switches: changing all the switch positions the micro can take the control of the board (the control system cannot be changed while the application is running). the connector that allows the communication between the two boards has 9 signals: the two control system have the same performances, but the microcontrolled application can change its char- acteristics just changing the code of the micro. if we wish to have a counted number of re-strike of the lamp after ignition failure we can choose any number we want (2, 8 or 23), just changing a parameter of the software. the same can be done if we connect another lamp that needs a different t pre or a different range of frequencies. analog version sw nr. function vs. l6574 ### ### sw1 pin 2 C r pre ### ### sw2 pin 8 C en1- shut down ### ### sw3 pin 7 C op amp ref. C pwm sw ### ### sw4 pin 1 c pre C power ok ### ### sw5 pin 9 C en2 ### ### sw6 pin 4 C r ign - pwm hw ref. # function analog ? micro 0 void: there is the hole but it is not connected 1gnd ? 2 pb3 (l6574 power ok) ? 3 l7805 input voltage ? 4 pb2 (ref. op-amp) sw pwm ? 5 pb6 pfc disable ? 6 pb7 ref. pin 4 = hw pwm ? 7 pc3 disconnected lamp ? 8 pc2 not ignited lamp ? 9 pb0 disable l6574 - en1 ?
11/20 AN1320 application note this is an added value of the micro. an important feature of the overall application is its modularity: we can have a board with the micro and a board without it changing very few parts, we can also put all the parts on the same pcb and then decide which con- nection to do. 7.0 comments: the lamp disconnection fault is managed as an interrupt not only for fast acting, but also for the characteristics of the application we have chosen. the st62e62c has just a pwm output, while the application needs two pwm. we have solved the problem using the software pwm. this is something very heavy for the micro to perform, and it influences all the other choices: e.g. a polling sequence is to expensive as time consuming and it influences the sw pwm duty cycle dynamic. it consumes ~25%-30% of the cycle, and this, added to 20% due to the 4 instructions to do the pwm itself was too large. that is the main reason why the disconnection fault is managed as an interrupt. of course there are different solutions. a feasible choice could be to use the hardware pwm to set the reference of the non inverting input and not to use the software pwm. but we should relay on the l6574 preheat and ig- nition sequence, where t pre , f pre and t ign are set by capacitors and resistors. this means that the m c has to supervise less items. a third choice might be to choose a m c with two pwm output: in this way the application has the same charac- teristics and the m c has an easier code to run. 8.0 references: 1] l6574 datasheet 2] an993: electronic ballast with pfc using l6574 and l6561 3] st62e62c datasheet 9.0 appendix: 1) flow chart 2) vardef.inc 3) ballast.asm
AN1320 application note 12/20 9.1 appendix 1: flow chart figure 9. appendix 1: flow chart st6 start up pb3 h? ["check power"] check pc3: h? ["start up sequence"] set pwm on pb7=duty_pre t>tpre? ["call tpre"] set ign freq. profile ["load duty cycle values from look up table"] check pc2: h? enable pwm1 on pb7 and pwm2[software] on pb2 check pa4 voltage<> 5v interrupts on pc3? nr tent = max tent ? pb0 & pb5 high wait for reset and/or power off n y y n y y n n y n y y n n
13/20 AN1320 application note 9.2 appendix 2 - vardef.inc ;***************************************************************************** ; ; module name: vardef.inc ; ;***************************************************************************** ; *** default duty cycle value for preheating duty_pre .equ 0beh ; *** maximum start-up sequence retrials max_tent .equ 3h ; *** default sw pwm duty cycle def_sw_duty.equ 0bch ; *** gen waiting timer parameters ; gen waiting = 2ms ; gentick = 11 -> 11*192us = 2.112 ms ; genrep = 1 gentick .equ 0bh genrepeat .equ 01h ; *** tpre waiting timer parameters ; tpre [0.5 ./. 2 sec] = 1 sec ; tpretick = 256 -> 256*192us = 49.152 ms ; tprerep = 21 -> 21*49.152ms = 1.032 s tpretick .equ 0ffh tprerepeat .equ 015h ; *** tign waiting timer parameters ; tign [(100 ./. 200)/64 msec] = 150/64 msec = 2.34 ms ; tigntick = 12 -> 12*192us = 2.3 ms ; tignrep = 1 tigntick .equ 0ch tignrepeat .equ 01h ; *** tad waiting timer parameters ; tad = c.a 500 ms ; tadtick = 256 -> 256*192us = 49.152 ms ; tadrep = 10 -> 10*49.152ms = 491 ms tadtick .equ 0ffh tadrepeat .equ 0ah .org 0f00h ; look-up table for pwm ; *hw* *sw* .byte 0bch,0b4h ; samp = 0 .byte 0c1h,0c8h .byte 0c2h,0cbh .byte 0c4h,0ceh .byte 0c6h,0d2h .byte 0cbh,0dbh .byte 0d0h,0e6h .byte 0d5h,0feh ; samp = 7
AN1320 application note 14/20 9.3 appendix 3 - ballast.asm ;***************************************************************************** ; ; module name: ballast.asm ; ;***************************************************************************** .romsize 4 .vers "st6262" .input "st626x.ini"; st626x data space & registers declaration .input "vardef.inc" ;========================================================== ; data variables ;========================================================== step .def 084h,0ffh,0ffh,m repeat .def 085h,0ffh,0ffh,m nrtent .def 086h,0ffh,0ffh,m media .def 087h,0ffh,0ffh,m count .def 088h,0ffh,0ffh,m sample .def 089h,0ffh,0ffh,m ;========================================================== ; ignition sweep pwm parameters ;========================================================== .org 0f40h .byte 0beh,0beh,0beh,0bfh,0bfh,0bfh,0c0h,0c0h .byte 0c0h,0c1h,0c1h,0c1h,0c2h,0c2h,0c2h,0c3h .byte 0c3h,0c3h,0c4h,0c4h,0c4h,0c5h,0c5h,0c5h .byte 0c6h,0c6h,0c6h,0c7h,0c7h,0c7h,0c8h,0c8h .byte 0c8h,0c9h,0c9h,0c9h,0cah,0cah,0cah,0cbh .byte 0cbh,0cbh,0cch,0cch,0cch,0cdh,0cdh,0cdh .byte 0ceh,0ceh,0cfh,0cfh,0d0h,0d0h,0d1h,0d1h .byte 0d1h,0d2h,0d2h,0d2h,0d3h,0d3h,0d3h,0d3h ;========================================================== ; inizialisation ;========================================================== .org 880h init reti clr ior ; disable interrupts (confirm reset value) ; *** oscillator and internal timer ldi oscr,08h ; set prescaler ratio @ 1 ldi tscr,27h ; timer1 no int, presc 128, lock ; *** port configuration ; port a: all input, no interrupt, pulled up, except pa4 analog - pa4 = a/d (in), pa5 = n/c ldi dra,10h clr ddra ldi opra,10h ; port b: port 2,6 and 7 output 0, push pull, value 1; port 3 input ; pb0 = 6574 disable pb2 = sw pwm (out), pb3 = power ok (in), ; pb6 = pfc disable (out), pb7 = hw pwm - autoreload timer (out) clr drb ldi ddrb,0c5h ldi oprb,0c5h
15/20 AN1320 application note ; port c: all input, no interrupt, pulled up (pc2 = no ign(in), pc3 = disc lamp (in)) clr drc clr ddrc clr oprc ; data rom window configuration ldi drwr,3dh ; = (0f40h >> 6) ; default duty cycle value on swpwm ldi v,def_sw_duty ; v = duty cycle set 2,drb ; swpwm port set ; a/d converter setup ldi adcr,10h ; ad w/out interrupt, turned on ; ar-timer configuration (hwpwm) ldi armc,20h ; autoreload mode, enabled, stopped, no int enabled ldi arlr,00h ; load register ldi arrc,80h ; reload register ldi arcp,duty_pre ; compare register set 7,armc ; load arrc and reset arsc1 res 7,armc ; stop load phase ldi arsc1,60h ; fint, prescaler /8 fpwm =7.8125khz set 6,armc ; start timer ;============================================== ; startup sequences ;============================================== checkpower ; "power ok" test twice jrr 3,drb,checkpower ; wait for pin = 1 ldi a,gentick ; load tick counter ld x,a ldi a,genrepeat ; load repetition time ld y,a call wait jrr 3,drb,checkpower ; test for pin data steady lampok ; *** test if lamp is connected jrr 3,drc,startheat ; if connected, go ahead ldi a,gentick ; load tick counter ld x,a ldi a,genrepeat ; load repetition time ld y,a call wait ; wait jrr 3,drc,startheat ; test twice for steady jp stopit ; unconnected lamp: rip startheat clr nrtent ; reset tentative counter preheat ; *** preheating waiting time ldi a,duty_pre ; set preheating duty-cycle ld arcp,a ldi a,tpretick ; load tick counter ld x,a ldi a,tprerepeat ; load repetition time ld y,a call wait
AN1320 application note 16/20 ignstart ; *** ignition sequence clr step ; reset lookup table index ignition ldi a,40h ; load duty-cycle value from look-up table add a,step ld x,a ld a,(x) ld arcp,a ; on comparator value ldi a,tigntick ; load tick counter ld x,a ldi a,tignrepeat ; load repetition time ld y,a call wait inc step ; update step counter ld a,step cpi a,40h ; if last value in table jrz ignited ; exit nop ; else next value nop jp ignition ignited inc nrtent ldi a,gentick ; load tick counter ld x,a ldi a,genrepeat ; load repetition time ld y,a call wait jrr 2,drc,lampon ; if lamp ignited (pc2=0) go ahead ld a,nrtent cpi a,max_tent ; if trial number overflows, stop jrz gotostop jp preheat ; else retry gotostop jp stopit lampon ; *** system working, set interrupt on portc, pin 2 and 3 clr ior clr ddrc ldi oprc,08h ; pc3 (no lamp) int pull-up clr drc ldi ior,30h ; enable global int, rising edge ; *** internal timer activation for a/d tracking res 3,tscr ; stop timer 1 set 6,tscr ; enable interrupt ldi a,tadtick ; load tick counter ld tcr,a ldi a,tadrepeat ; load repetition time ld repeat,a set 3,tscr ; start timer ; new data rom window configuration ldi drwr,3ch ; = (0f00h >> 6)
17/20 AN1320 application note ;============================================== ; main loop ;============================================== res 0,arsc0 nop main jrr 0,arsc0,main res 0,arsc0 set 2,drb ; set swpwm output swpwmloop ld a,arlr cp a,v jrc swpwmloop res 2,drb ; reset swpwm output jp main ;============================================== ; routines ;============================================== ;============================================== ; stop all operations and disables chips ;============================================== stopit set 0,drb ; disable 6574 set 6,drb ; disable pfc rip jp rip ; do nothing ; ============================================= ; wait: holds for a time:=x*y*192us ; x = 192us ticks number to hold ; y = repeat times ; ============================================= wait ld a,y ; load repeat time nr. ld repeat,a waitrestart ld a,x ; load counter value ld tcr,a set 3,tscr ; timer start waittimerexp jrr 7,tscr,waittimerexp res 7,tscr ; timer expired, reset flag dec repeat ld a,repeat jrnz waittimerexp ; waitagain res 3,tscr ; repetition timer expired, reset ret ;========================================================== ; setup a/d converter ;========================================================== sadc clr media; reset media register ldi count,04h ; init counter set 5,adcr ; start a/d conversion nop nop set 7,adcr ; enable interrupt ret
AN1320 application note 18/20 ;========================================================== ; interrupt routines ;========================================================== ; *** port a ; unused ipa reti ; *** port c ; test if some signal went up ipc ld w,a ; save accumulator jrs 2,drc,pc2 ; test port c, pin 2 pc2end jrs 3,drc,pc3 ; test port c, pin 3 pc3end ld a,w ; restore accumulator reti pc2 ; pc2 issued nop nop jrr 2,drc,pc2end ; confirm steady on pin jp stopit ; stop operations pc3 nop nop jrr 3,drc,pc3end ; confirm steady on pin jp stopit ; stop operations ;========================================================== ; dispatchirq4: test if timer or ad interrupt ;========================================================== dispatchirq4 jrs 7,tscr,itim ; test for timer interrupt jrs 6,adcr,iadc ; test for ad interrupt reti ;========================================================== iadc res 7,adcr ; disable interrupt ld a,adr ; load sample ld sample,a ld a,count ; test for maximum sample jrnz conversion ; maximum reached reti conversion ld a,sample ; a = sample rlc a ; a = a >> 4 rlc a rlc a rlc a andi a,07h ; 8 levels add a,media ld media,a dec count ld a,count jrz setsamp set 5,adcr ; enable a/d converter nop
19/20 AN1320 application note nop set 7,adcr ; enable interrupt reti ; restart fo new sample setsamp ld a,media ; media=+last 4 conversion andi a,01ch rlc a rlc a rlc a rlc a rlc a rlc a rlc a ; sample=media/4 (media >> 2) ld sample,a rlc a ; offset for table look-up (@ 0x40) addi a,040h ld x,a ld a,(x) ld arcp,a ; hw pwm inc x ld a,(x) ld v,a ; sw pwm reti ;========================================================== itim ldi a,tadtick ; load tick counter ld tcr,a res 7,tscr ; reset tout flag dec repeat ld a,repeat jrnz getout ; waitagain res 3,tscr ; repetition timer expired, reset call sadc ldi a,tadrepeat ; load repetition time ld repeat,a set 3,tscr ; start timer getout reti ;========================================================== artint reti ; autoreload timer interrupt inmi reti ; not used .org 0ff0h irq4 jp dispatchirq4 irq3 jp artint irq2 jp ipc irq1 jp ipa .block 4 nmi jp inmi vrst jp init .end
information furnished is believed to be accurate and reliable. however, stmicroelectronics assumes no responsibility for the co nsequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of stmicroelectronics. specifications mentioned in this publicati on are subject to change without notice. this publication supersedes and replaces all information previously supplied. stmicroelectronics prod ucts are not authorized for use as critical components in life support devices or systems without express written approval of stmicroelectro nics. the st logo is a registered trademark of stmicroelectronics a 2000 stmicroelectronics - all rights reserved stmicroelectronics group of companies australia - brazil - china - finland - france - germany - hong kong - india - italy - japan - malaysia - malta - morocco - sin gapore - spain - sweden - switzerland - united kingdom - u.s.a. http://www.st.com 20/20 AN1320 application note


▲Up To Search▲   

 
Price & Availability of AN1320

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X